package cn.acmenms.po.vo;

/**
 * @ClassName: SimplePage
 * @Description: 简单分页类，实现百度动态分页条效果
 * @author: 神奇的鸭鸭
 * @Date: 2017/12/28 0:22
 */
public class SimplePage {

    private int pageNum; // 第几页
    private int totalCount; // 总记录数
    private int pageSize; // 每页显示数
    private int totalPage; // 总分页数
    private int start; // limit
    private int end; // limit

    public SimplePage(int pageNum, int totalCount, int pageSize) {
        if(pageNum <= 1) {
            pageNum = 1;
        }
        this.pageNum = pageNum;
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.totalPage = (this.totalCount + pageSize - 1) / pageSize;
        // 数据库查询所需
        this.start = (this.pageNum - 1) * this.pageSize;
        this.end = this.pageSize;
    }

    public SimplePage(int start, int end) {
        this.start = start;
        this.end = end;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public int getStart() {
        return start;
    }

    public void setStart(int start) {
        this.start = start;
    }

    public int getEnd() {
        return end;
    }

    public void setEnd(int end) {
        this.end = end;
    }
}